I want to offer a pay-as-you-go introductory offer for a subscription in my iOS app. But it's not clear to me what the actual pricing is if the offer is on a subscription whose period is more than 1 unit (2 month, 3 month, 6 month, etc).
For example, say I have a subscription that costs $20 per renewal and renews every 6 months. I set up an intro offer of the "Pay as you go" type (SKProductDiscountPaymentModePayAsYouGo) whose duration is 12 months and price is $10. Is the user going to get charged $10/month for 12 months (renewing 12 times), or $10 per 6 months for 12 months (renewing twice)?
The documentation - https://developer.apple.com/documentation/storekit/in-app_purchase/subscriptions_and_offers/implementing_introductory_offers_in_your_app?language=objc isn't all that clear on this. If I set this up with a local StoreKit test file - https://developer.apple.com/documentation/xcode/setting_up_storekit_testing_in_xcode?language=objc and try it in a simulator, the system purchase sheet appears to actually display it wrong. In my scenario above, the simulator shows a trial of "$10 per month for 2 months". I've filed this as FB8998598.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm working on enabling Catalyst for my existing iOS app. When I try to archive and export Catalyst as a Developer ID-signed Mac app, I get the following error:
Cannot create a Mac Catalyst Developer ID provisioning profile for "[my bundle ID]".
The Siri capability is not available for Mac Catalyst Developer ID provisioning profiles. Disable this feature and try again.
My iOS app uses SiriKit to donate a Siri intent, so Siri is among the capabilities listed in the Signing and Capabilities tab in the project inspector in Xcode. I don't see a way to turn that capability off only for Catalyst (like you can link some frameworks only for Catalyst or iOS), and I don't want to disable Siri entirely in my iOS app.
What's going on here? What do I need to do to "disable this feature" for Catalyst?
I have a UICollectionView tied to a UICollectionViewDiffableDataSource, and I'm generating and applying snapshots to the datasource on a background serial queue, and generating cells using UICollectionViewCellRegistration. I'm working on supporting reordering of the contents of the collection view via drag and drop, and I'm having trouble with what to do in collectionView:performDropWithCoordinator: so the reorder animation looks right.
Normally, I would do something like this:
-(void)collectionView:(UICollectionView *)collectionView performDropWithCoordinator:(id<UICollectionViewDropCoordinator>)coordinator
{
NSIndexPath *sourcePath = (NSIndexPath *)coordinator.items.firstObject.dragItem.localObject;
NSInteger fromIndex = sourcePath.item;
NSInteger toIndex = coordinator.destinationIndexPath.item;
NSNumber *fromItem = [self.datasource itemIdentifierForIndexPath:sourcePath];
NSNumber *toItem = [self.datasource itemIdentifierForIndexPath:coordinator.destinationIndexPath];
//Do the move in the data model
[MyModel moveItemFrom:fromIndex to:toIndex];
//Do the move in the datasource. This is the data source equivalent of:
//[collectionView moveItemAtIndexPath:sourcePath toIndexPath:coordinator.destinationIndexPath];
NSDiffableDataSourceSnapshot *snap = self.datasource.snapshot;
if (toIndex < fromIndex)
[snap moveItemWithIdentifier:fromItem beforeItemWithIdentifier:toItem];
else
[snap moveItemWithIdentifier:fromItem afterItemWithIdentifier:toItem];
[self.dataSource applySnapshot:snap animated:YES];
//Drop the item
[coordinator dropItem:coordinator.items.firstObject.dragItem toItemAtIndexPath:coordinator.destinationIndexPath];
}
But because my datasource updates happen on a background queue, I have to do at least the snapshot generation and application asynchronously, and I'd like to do the actual data model modification there too to avoid hangs. And I need to call dropItem on the coordinator on the main queue in this method. This results in an odd animation where the dropped item momentarily disappears (when drop is called) and then reappears (when the data source is updated on the background queue).
The best idea I have so far is to use UICollectionViewDropPlaceholder to hold the place in the collection view until the data source is updated. But to create a placeholder I need a cell reuse identifier (docs on init method), and I don't have one of those because I'm creating my cells using cell registrations.
So my question: what do I do in the performDrop method to make this work correctly? If the placeholder is the right idea, how do I use it in this situation?
I work on an e-reader app that sells books as IAPs. We have a lot - about 20,000 or so. This is over Apple's limit of 10,000 IAPs, so we've had to ask them to raise the limit for us more than once. Recently, at Apple's suggestion, we finally switched to a mechanism called Price Tiers, where instead of having one IAP item in App Store Connect for each of our products, we have one item per price level, so if the user buys product ID (in our system) 12345 for $5, instead of buying non-consumable IAP ID com.mycompany.myapp.12345, they buy consumable IAP ID com.mycompany.myapp.price_tier.5. In our system, we link the purchase to product 12345 at the time of receipt verification and everything works great.
But I have an issue that manifests when the user is using Ask to Buy or when receipt validation fails in our back-end, I don't call finishTransaction, and the transaction is retried later. The sequence is this:
User buys product 12345, which is com.mycompany.myapp.price_tier.5
The user has Ask to Buy enabled, so the transaction ends in the deferred state, and the IAP flow on the device is done for now
At some point later, the user gets permission for the purchase, and my SKPaymentQueue delegate gets notified of the transaction again in the background
But at the point of step 3, I have no way of knowing what product in our system the transaction is for. The same issue occurs if receipt verification fails on our end - I don't call finishTransaction, so StoreKit retries it later, but again at that point I don't know which one of our products to register to the user's account.
How do I make Ask to Buy (or any situation where I get notified of a transaction outside of a user-driven purchase) work with Price Tiers?
In the session on StoreKit 2 (which looks amazing!), the presenter says:
In fact, if your app is running when a purchase is made on another device, you'll be notified about the new transaction.
This seems to mean that when an app uses the listener API to be notified of transactions, it will get transactions that happened on other devices.
My app offers purchases across other platforms in addition to iOS, and when a purchase happens we register it with our own account system. If a user has the app running on both their iPad and iPhone and makes a purchase on the phone, if the iPad gets notified of it the same way it would of a purchase made on the iPad, both devices will try to report it to our system. This seems undesirable.
What's the recommended approach here? Should we just make sure our system will disregard duplicate transaction reports? Or is there a way to know whether a transaction originated on this device? I don't see a property on the transaction type that looks like it could accomplish this. Maybe the deviceVerification properties? But that's seems more like the new edition of transaction receipt verification - failing that check would presumably mean that the purchase is invalid, not that it didn't happen on this device...?
I notice in iOS 14 beta 4, collection views show index views on their trailing edge if the data source implements indexTitlesForCollectionView - https://developer.apple.com/documentation/uikit/uicollectionviewdatasource/2851455-indextitlesforcollectionview?language=objc and indexPathForIndexTitle - https://developer.apple.com/documentation/uikit/uicollectionviewdatasource/2851456-collectionview?language=objc. But I don't see a way to control any aspect of its appearance. On UITableView this shows up as the sectionIndexColor - https://developer.apple.com/documentation/uikit/uitableview/1614915-sectionindexcolor?language=objc property.
Does this property exist on UICollectionView somewhere I didn't think to look? Or is it just not there (yet)?
FB8284500
I have a UICollectionView that I feed data into using UICollectionViewDiffableDataSource. I want to display a scroll scrubber on the trailing edge of it, like I'd get if I implemented the data source methods indexTitlesForCollectionView and indexPathForIndexTitle. But the data source is the diffable data source object, and there's no property or closure on it to supply index titles as of iOS 15.
How are index titles supposed to work with UICollectionViewDiffableDataSource?
How can I use UICollectionViewDiffableDataSource reorderHandlers with a custom compositional layout?
As of iOS 14, UICollectionViewDiffableDataSource has a reorderHandlers property. It's demonstrated in some sample code and talked about in WWDC 2020 session on Advances in Diffable Data Sources. The presenter states that you have to provide a canReorder and didReorder closure to enable the feature.
The sample code uses it in a collection view with a list layout configuration, and configures the list cells with reorder accessories. The canReorder and didReorder methods are called as expected. But if I remove the reorder accessories from the cells, reordering no longer works - it doesn't call either closure. It also doesn't work in my app, where I have a grid layout using a compositional layout.
How do I enable reordering on UICollectionViewDiffableDataSource without list cells and reorder accessories?
I have an iPad app in which I'm starting to support multiple windows / scenes. I have one main window type, let's say MainScene, and at least one secondary window type for opening specific types of content, say DetailScene.
I have not declared my scene types in Info.plist. I have implemented application:configurationForConnectingSceneSession:options: like this:
-(UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options
{
NSUserActivity *activity = options.userActivities.anyObject;
NSString *activityType = activity.activityType;
if ([activityType isEqualToString:@"detailType"])
return [DetailSceneDelegate makeSceneConfiguration];
return [MainSceneDelegate makeSceneConfiguration];
}
Say I perform these steps:
Launch app for the first time. I get a call to configurationForConnectingSceneSession, and the activity type is nil so it returns a MainScene.
Open a new window for some piece of content. That uses the detail scene activity type, so configurationForConnectingSceneSession returns a DetailScene. Creating the new scene looks like this:
NSUserActivity *activity = [[NSUserActivity alloc] initWithActivityType:@"detailType"];
activity.userInfo = @{@"content_id": @(contentRowId)};
[[UIApplication sharedApplication] requestSceneSessionActivation:nil userActivity:activity options:nil errorHandler:nil];
Suspend the app and open the app switcher. Discard (by flicking up) first the main window and then the detail window. The app is now killed.
Relaunch the app.
At this point I do not get a call to configurationForConnectingSceneSession. I get the detail scene back, restored from its user activity, with calls straight to DetailSceneDelegate.
My question: how do I control what scene gets restored in this situation? I want my main scene to come back.
Messages and Mail and Notes all do this. If you open Messages and drag a conversation out into a new window, you get a window for that conversation with a Done button in the corner that will dismiss the window. If you perform my steps above with Messages, you will relaunch to the full Messages view. Are they converting the detail view to a main view on the fly? Or is there a way to tell the system that the detail scene is secondary and should not be restored first, or that I should get asked what I want to restore via configurationForConnectingSceneSession? Or something else?
I have an iOS app that can play audio books as FairPlay DRM'd audio streams. I'm using AVContentKeySession to fetch keys and AVQueuePlayer to play. It works great on iOS, but on Catalyst (Monterey 12.3.1, M1 Max MacBook Pro) it crashes. When it happens in debug, I get a message "Too few bits left in input buffer" printed to the console, and an exception is thrown in the guts of what appears to be core media. Here's the output from [NSThread callStackSymbols] when paused on an exception breakpoint at that point:
0 ??? 0x0000000156b8cc9c 0x0 + 5749918876,
1 BRFree 0x000000010445cf08 main + 0,
2 AudioCodecs 0x0000000157918c24 _ZL11GetPropertyPvjPjS_ + 52,
3 AudioToolboxCore 0x00000001862536a4 _ZN15ADTSAudioStream11ParseHeaderER27AudioFileStreamContinuation + 1060,
4 AudioToolboxCore 0x000000018624259c AudioFileStreamParseBytes + 412,
5 MediaToolbox 0x00000001915f7d98 FigManifoldCreateForICY + 2176,
6 MediaToolbox 0x00000001915f7718 FigManifoldCreateForICY + 512,
7 MediaToolbox 0x00000001916bbd78 FigPlayerStreamCreate + 315920,
8 MediaToolbox 0x0000000191a269a0 FigMetadataConverterCreateForQuickTimeToFromiTunes + 45888,
9 MediaToolbox 0x0000000191a4a290 FigMetadataConverterCreateForQuickTimeToFromiTunes + 191536,
10 MediaToolbox 0x0000000191a2a470 FigMetadataConverterCreateForQuickTimeToFromiTunes + 60944,
11 MediaToolbox 0x0000000191a28c34 FigMetadataConverterCreateForQuickTimeToFromiTunes + 54740,
12 MediaToolbox 0x0000000191a413b4 FigMetadataConverterCreateForQuickTimeToFromiTunes + 154964,
13 MediaToolbox 0x0000000191a2f144 FigMetadataConverterCreateForQuickTimeToFromiTunes + 80612,
14 MediaToolbox 0x00000001917cae64 FigAlternateFilterMonitorCreateForThermalNotification + 30428,
15 MediaToolbox 0x00000001917ccb44 FigAlternateFilterMonitorCreateForThermalNotification + 37820,
16 MediaToolbox 0x00000001917cb134 FigAlternateFilterMonitorCreateForThermalNotification + 31148,
17 CFNetwork 0x0000000189937cd4 _CFHostIsDomainTopLevelForCertificatePolicy + 27728,
18 Foundation 0x0000000185ba980c __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 24,
19 Foundation 0x0000000185ba96b4 -[NSBlockOperation main] + 104,
20 Foundation 0x0000000185ba9644 __NSOPERATION_IS_INVOKING_MAIN__ + 24,
21 Foundation 0x0000000185ba88dc -[NSOperation start] + 788,
22 Foundation 0x0000000185ba85c0 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 24,
23 Foundation 0x0000000185ba8478 __NSOQSchedule_f + 184,
24 libdispatch.dylib 0x00000001099f60f4 _dispatch_block_async_invoke2 + 148,
25 libdispatch.dylib 0x00000001099e2394 _dispatch_client_callout + 20,
26 libdispatch.dylib 0x00000001099eb778 _dispatch_lane_serial_drain + 980,
27 libdispatch.dylib 0x00000001099ec814 _dispatch_lane_invoke + 492,
28 libdispatch.dylib 0x00000001099f9fc8 _dispatch_root_queue_drain + 408,
29 libdispatch.dylib 0x00000001099f9d3c _dispatch_worker_thread + 264,
30 libsystem_pthread.dylib 0x00000001094e1890 _pthread_start + 148,
31 libsystem_pthread.dylib 0x00000001094ebaa8 thread_start + 8
In the Debug Navigator, the top of the stack looks a little different:
#0 0x0000000184bdeb3c in __cxa_throw ()
#1 0x000000015791941c in ACMP4AACLowComplexityDecoder::GetProperty(unsigned int, unsigned int&, void*) ()
#2 0x0000000157918c24 in GetProperty(void*, unsigned int, unsigned int*, void*) ()
#3 0x00000001862536a4 in ADTSAudioStream::ParseHeader(AudioFileStreamContinuation&) ()
#4 0x000000018624259c in AudioFileStreamParseBytes ()
#5 0x00000001915f7d98 in ___lldb_unnamed_symbol598$$MediaToolbox ()
What's going wrong here? Can anyone give me direction on what to fix? Or is FairPlay audio not even expected to work in Catalyst at this point?
I've got a UIBarButtonItem in my app that currently presents an action sheet of items. I want to switch this to a UIMenu with iOS 14's new APIs for buttons and bar button items. But somme of the contents of the action sheet change based on the state of the view controller when the action sheet is triggered.
With the action sheet, I generate a different action sheet every time the bar button item's target action is called. But with the new APIs, I have to generate the menu ahead of time and assign it to the button.
What's the best way to get the menu to update every time it's presented? I tried UIDeferredMenuElement, but it caches the result of its provider.
Feedback FB7824467 suggests adding a property to UIDeferredMenuElement to disable the caching of the provider result.
I have an iOS app that I'm looking to make available as a Catalyst app. I have various view controllers that I present using custom animations and presentation styles via UIViewControllerTransitioningDelegate, UIViewControllerAnimatedTransitioning, UIPresentationController, et al.
Most of the view controllers I present with my custom styles are UINavigationController instances (or subclasses thereof). And when I build and run my Catalyst app on Ventura, the titles and bar items for the navigation items of the view controllers in the navigation stack get moved to the title bar of the application, and the navigation bar doesn't appear at all in the presented view controller.
Why is this happening, and how do I stop it? I've looked through the documentation for the APIs I mentioned above and tried setting various things that seemed like they could conceivably be relevant - UIPresentationController.shouldPresentInFullscreen, UIViewController.modalInPresentation, etc - and have had no luck.
I'm adding some text formatting support to an editable text view in my app, and I want to include bulleted lists. I specifically want to have the standard behavior where if you're typing a line of text in a list and press Enter, the next bullet item is automatically inserted.
This appears to somewhat work out-of-the-box with NSTextList on iOS 16, unless the line you're editing is at the very end of the document. This is apparent in the sample code for WWDC 2022 session 10090 (project is here):
Run that sample app and switch to the List tab
Put your cursor at the end of any line except the last one and press enter. You get a new list item, as expected.
Put your cursor at the end of the very last line and press Enter. You don't get a list item until you type something on that line.
I've likewise found that if I have this text in a text view:
Hello World\n\nList here\n
If I format the text List here as a bulleted list (by creating an NSMutableParagraphStyle with its textLists property set and adding it to the attributed string for that range) and press Enter at the end of the word Here, I get a new bullet item automatically. But if I do the same thing without having that last newline after Here, the new list item is not inserted.
How can I make the list auto-continuation behavior work at the end of the document?
One of the things discussed in Understanding the exception types in a crash report is the 0xdead10cc code under EXC_CRASH (SIGKILL):
0xdead10cc (pronounced “dead lock”). The operating system terminated the app because it held on to a file lock or SQLite database lock during suspension.
My app gets killed this way here and there, and it's been on my project list for some time to make the requisite changes to database connection handling to fix it. With an App Store build, as far as I know it just means the app cold-starts when launched instead of resuming, but in a TestFlight build it actually shows a crash reporter dialog.
Reports of this issue from TestFlight users got more frequent with a recent update that had the effect of keeping more SQLite handles open longer, and I realized that I personally have never seen a crash reporter dialog after fast-app-switching away from a TestFlight build on my device. And I use the TF build as my daily driver, and I use my app a lot.
My question is this: is it possible that the 0xdead10cc crash doesn't happen on Developer Mode devices?